const {
  defineConfig
} = require('@vue/cli-service')
const AutoImport = require("unplugin-auto-import/webpack")
const Components = require("unplugin-vue-components/webpack")
const {
  ElementPlusResolver
} = require("unplugin-vue-components/resolvers")

module.exports = defineConfig({

  transpileDependencies: true,
  devServer: {
    port: 8000,
    // 配置端口号
    open: true,
    // 配置服务器自动打开浏览器
    https: true,
    // 是否开启https协议
    host: 'localhost',
    //设置主机名
    proxy: {
      '/api': {
        target: 'https://unidemo.dcloud.net.cn/api',
        changeOrigin: true, // 开启代理
        pathRewrite: { // 重写路径
          '^/api': ''
        }
      }
    },

  },
  configureWebpack: {
    plugins: [
      AutoImport({
        resolvers: [ElementPlusResolver()]
      }),
      Components({
        resolvers: [ElementPlusResolver()]
      })
    ]
  }
})